package io.renren.modules.eas.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.eas.entity.EasBasicTeacherandclazzEntity;
import io.renren.modules.eas.service.EasBasicTeacherandclazzService;



/**
 * 老师_任教班级表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-09-26 23:32:06
 */
@RestController
@RequestMapping("eas/easbasicteacherandclazz")
public class EasBasicTeacherandclazzController {
    @Autowired
    private EasBasicTeacherandclazzService easBasicTeacherandclazzService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("eas:easbasicteacherandclazz:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = easBasicTeacherandclazzService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("eas:easbasicteacherandclazz:info")
    public R info(@PathVariable("id") Long id){
		EasBasicTeacherandclazzEntity easBasicTeacherandclazz = easBasicTeacherandclazzService.getById(id);

        return R.ok().put("easBasicTeacherandclazz", easBasicTeacherandclazz);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("eas:easbasicteacherandclazz:save")
    public R save(@RequestBody EasBasicTeacherandclazzEntity easBasicTeacherandclazz){
		easBasicTeacherandclazzService.save(easBasicTeacherandclazz);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("eas:easbasicteacherandclazz:update")
    public R update(@RequestBody EasBasicTeacherandclazzEntity easBasicTeacherandclazz){
		easBasicTeacherandclazzService.updateById(easBasicTeacherandclazz);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("eas:easbasicteacherandclazz:delete")
    public R delete(@RequestBody Long[] ids){
		easBasicTeacherandclazzService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

    /**
     * 列表
     */
    @RequestMapping("/search")
    // @RequiresPermissions("eas:easbasicteacherandclazz:search")
    public R search(@RequestParam Map<String, Object> params, @RequestParam Long search){
        PageUtils page = easBasicTeacherandclazzService.searchPage(params, search);

        return R.ok().put("page", page);
    }
}
